package com.umgsai.thread.thread69;

public class MyThread extends Thread {
	@Override
	public void run() {
		String username = null;
		System.out.println(username.hashCode());
	}
	
	public static void main(String[] args) {
		MyThread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
					
					@Override
					public void uncaughtException(Thread t, Throwable e) {
						System.out.println(t.getName() + "出现了异常");
						e.printStackTrace();
					}
				});
		MyThread t1 = new MyThread();
		t1.setName("线程1");
		t1.start();
		MyThread t2 = new MyThread();
		t2.setName("线程2");
		t2.start();
	}
}
